//
//  main.m
//  通知机制
//
//  Created by zzn on 2016/11/4.
//  Copyright © 2016年 zmxgrgnzzn. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Notificationsender.h"
#import "NotificationListener.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        //1.创建通知发布者
        Notificationsender * sender=[[Notificationsender alloc]init];
        
        //2.创建通知监听者
        NotificationListener *listener=[[NotificationListener alloc]init];
        
        //3. 创建通知中心
        NSNotificationCenter *cender=[NSNotificationCenter defaultCenter];
        
        //4.监听者监听通知
        [cender addObserver:listener selector:@selector(getExpress) name:@"message" object:sender];
        
        //5.发布通知
        [cender postNotificationName:@"message" object:sender];
        
        
    }
    return 0;
}
